package com.smartcanteen.system.api.clients;

import com.smartcanteen.system.api.domain.dto.SetmealDTO;
import com.smartcanteen.system.api.domain.entity.Result;
import com.smartcanteen.system.api.domain.entity.Setmeal;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("smartcanteen-setmeal")
public interface SetmealClient {
    @GetMapping("/admin/setmeal/getSetmealIdsByDishIds")
    List<Integer> getSetmealIdsByDishIds(@RequestParam("ids") List<Integer> ids);

    @GetMapping("/user/setmeal/getSetmealById/{id}")
    Setmeal getSetmealById(@PathVariable("id") Integer id);

    @PostMapping("/admin/setmeal/api/add")
    @CacheEvict(cacheNames = "setmealCache", allEntries = true)
    void addSetmealForApi(@RequestBody SetmealDTO setmealDTO);


    @DeleteMapping("/admin/setmeal/api/deleteBatch")
    @CacheEvict(cacheNames = "setmealCache", allEntries = true)
    void deleteBatchForApi(@RequestParam("ids") List<Integer> ids);


    @PutMapping("/admin/setmeal/api/status")
    @CacheEvict(cacheNames = "setmealCache", allEntries = true)
    Result onOffForApi(@RequestParam("id") Integer id);
}
